import time
# 定义异步函数
import asyncio

async def task(name, delay):
    print(f"Executing task: {name}")
    await asyncio.sleep(delay)
    print(f"Task {name} finished")

async def taskUpdateView(name,delay,loginUserVo):
    print(f"Executing task: {name},loginUserVo",loginUserVo)
    await asyncio.sleep(delay)
    print(f"Task {name} finished")


async def taskUpdateView2(name,delay):
    print(f"Executing task: {name}")
    await asyncio.sleep(delay)
    print(f"Task {name} finished")

if __name__ == '__main__':
    # 创建事件循环
    loop = asyncio.get_event_loop()

    # 创建任务列表
    tasks = [
        task("更新用户信息", 2),
        task("下注", 1),
        task("更新信息", 3),
        taskUpdateView("退出账号", 1,"123"),
        taskUpdateView2("登录信息", 1),
    ]

    # 并发执行任务
    loop.run_until_complete(asyncio.gather(*tasks))

    # 关闭事件循环
    loop.close()
